package com.aaa.error;

import com.aaa.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalHandlerExceptionResolver {

    @ExceptionHandler(MethodArgumentNotValidException.class)
    public Result methodArgumentNotValidException(Exception  e){

        log.info("参数有问题"+e.getMessage());

        return  Result.error(e.getMessage());
    }

}
